-
Notifications
You must be signed in to change notification settings - Fork 27.4k
feat(input): add opt-in support for input[range]
#15229
Conversation
input[range]
My initial comment is that we need to check that other things that were changed in these commits are not impacted, such as ngMax, ngMin, ngStep(?), etc. |
With the exception of this line (which should not affect other inputs afaict), there has been no change in any input type other than |
function numberInputType(scope, element, attr, ctrl, $sniffer, $browser) { | ||
badInputChecker(scope, element, attr, ctrl); | ||
numberFormatterParser(ctrl); | ||
baseInputType(scope, element, attr, ctrl, $sniffer, $browser); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It probably doesn't make any difference but we should probably switch this line with the line above to ensure the order of the code is the same as previously.
@@ -883,7 +883,8 @@ var NgModelController = ['$scope', '$exceptionHandler', '$attrs', '$element', '$ | |||
ctrl.$viewValue = ctrl.$$lastCommittedViewValue = viewValue; | |||
ctrl.$render(); | |||
|
|||
ctrl.$$runValidators(modelValue, viewValue, noop); | |||
// It is possible that model and view value have been updated during render | |||
ctrl.$$runValidators(ctrl.$modelValue, ctrl.$viewValue, noop); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So this is not a breaking change because if $render didn't change the value then it will be the same as before, right? I think it is only the range input that is likely to do this...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Among the built-in $render
function, yes. But the truth is it could be a breaking change for user defined $render
functions (theoretically).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Although even in that case, it could be considered a fix 😁
['scheme://例子.测试', true], | ||
['scheme://उदाहरण.�रीक्षा', true], | ||
['scheme://उदाहरण.???ीक्षा', true], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm, I wonder if this change is right? It looks like previously the strings were UTF-16?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ooops! No idea how that sneaked in.
@@ -351,7 +351,7 @@ describe('validators', function() { | |||
|
|||
|
|||
it('should accept values of any length when maxlength is non-numeric', function() { | |||
var inputElm = helper.compileInput('<input type="text" ng-model="value" ng-maxlength="{{maxlength}}" />'); | |||
var inputElm = helper.compileInput('<input type="text" ng-model="value" ng-maxlength="maxlength" />'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess that this was a bad test in the first place is not really part of this PR? Perhaps, if so, then when you are squashing all this, we move this change into its own commit?
5e09fa7
to
60ccaca
Compare
I think it's pretty unorthodox of us to provide an opt-in for a regular input in core, especially since it becomes the default in 1.6. We are also forcing Googlers to update to 1.6 sooner if we leave it out of 1.5 ;) But the implementation is clean, so we might as well. Although I would like to see the refactor commits that affect other inputs in a separate commit. |
This commit re-applies the related (previously reverted) commits. A follow-up commit will make the support opt-in in order to avoid a breaking change. Included commits: - 296da4b - `feat(input): add support for binding to input[type=range]` (previously reverted with 6a167e8) - b78539b - `fix(input[range]): correctly handle min/max; remove ngMin/ngMax support` (previously reverted with aa60491) - 90c08b8 - `feat(input[range]): support step` (previously reverted with 5b633d8)
60ccaca
to
c94a921
Compare
I have tidied this up and fixed docs. (I also changed |
What kind of change does this PR introduce? (Bug fix, feature, docs update, ...)
Feature
What is the current behavior? (You can also link to an open issue here)
input[range]
is not supported.What is the new behavior (if this is a feature change)?
Support for
input[range]
can be opted into, by using theng-range-input
attribute.Does this PR introduce a breaking change?
No.
Please check if the PR fulfills these requirements
Other information:
This is a POC. Docs need to be updated.